﻿using System;
using com.fukefu.sql;

namespace com.fukefu
{
    public partial class ChangerPasswordForm : BaseForm
    {
        public ChangerPasswordForm()
        {
            InitializeComponent();
        }
        //修改密码
        private void button1_Click(object sender, EventArgs e)
        {
            SqlServerOperate sql = SqlServerOperate.GetInstance();
            string p1 = textBox1.Text;
            string p2 = textBox2.Text;
            string p3 = textBox3.Text;
            string p4 = textBox4.Text;
            if (p3.Equals(p4) && !p1.Equals("") && !p2.Equals(""))
            {
                if (sql.Update("update 全局设置.dbo.用户 set password='" + MyFunction.Md5(p3) + "' where name='" + p1 + "' and password='" + MyFunction.Md5(p2) + "'") == 1)
                {
                    ShowMessageDialog("更新成功,用新密码登陆!");
                }
                else
                {
                    ShowMessageDialog("更新失败,请修改!");
                }
            }
            else
            {
                ShowMessageDialog("输入错误,请更改!");
            }
        }
    }
}
